@{
    List<Tuple<string, string>> pages = Context
        .Documents[Docs.Pages]
        .Where(x => x.Bool(DocsKeys.ShowInNavbar, true))
        .Where(x => x.FilePath(Keys.RelativeFilePath)?.FullPath?.StartsWith("index") == (bool?)false)
        .Select(x => Tuple.Create(x.WithoutSettings.String(Keys.Title), Context.GetLink(x)))
        .Where(x => !string.IsNullOrEmpty(x.Item1))
        .OrderBy(x => x.Item1)
        .ToList();
    if(Documents[Docs.BlogPosts].Any())
    {
        pages.Add(Tuple.Create(Context.String(DocsKeys.BlogTitle), Context.GetLink(Context.String(DocsKeys.BlogPath))));
    }
    if(Documents[Docs.Api].Any())
    {
        pages.Add(Tuple.Create("API", Context.GetLink(Context.DirectoryPath(DocsKeys.ApiPath))));
    }
    foreach(Tuple<string, string> page in pages)
    {
        string active = Context.GetLink(Document).StartsWith(page.Item2) ? "active" : null;
        <li class="@active"><a href="@(page.Item2)">@(page.Item1)</a></li>
    }
}